package cn.org.itool.common.exception;

import cn.org.itool.common.constent.ErrorCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 自定义异常
 *
 * @author 祥霸
 * @version 1.0.0
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class BizException extends RuntimeException {
    private Integer code;

    private String message;

    public BizException(ErrorCode errorCode) {
        super(errorCode.code() + ":" + errorCode.msg());
        this.code = errorCode.code();
        this.message = errorCode.msg();
    }

    public BizException(ErrorCode errorCode, String msg) {
        super(errorCode.code() + ":" + errorCode.msg());
        this.code = errorCode.code();
        this.message = msg;
    }
}
